import request from '@/utils/request'

// 获取管理区域管辖范围配置列表(带分页)
export function getAreaJurisdictionList(data) {
  return request({
    url: '/api/campus/areaJurisdiction',
    method: 'GET',
    data
  })
}

// 获取管理区域管辖范围配置列表(下拉框)
export function getAreaJurisdictionSelector() {
  return request({
    url: '/api/campus/areaJurisdiction/selector',
    method: 'GET'
  })
}

// 添加管理区域管辖范围配置
export function createAreaJurisdiction(data) {
  return request({
    url: '/api/campus/areaJurisdiction',
    method: 'POST',
    data
  })
}

// 获取管理区域管辖范围配置详情
export function getAreaJurisdictionInfo(id) {
  return request({
    url: `/api/campus/areaJurisdiction/${id}`,
    method: 'GET'
  })
}

// 修改管理区域管辖范围配置
export function updateAreaJurisdiction(id, data) {
  return request({
    url: `/api/campus/areaJurisdiction/${id}`,
    method: 'PUT',
    data
  })
}

// 删除管理区域管辖范围配置
export function deleteAreaJurisdiction(id) {
  return request({
    url: `/api/campus/areaJurisdiction/${id}`,
    method: 'DELETE'
  })
}

// 批量删除管理区域管辖范围配置
export function batchDeleteAreaJurisdiction(ids) {
  return request({
    url: '/api/campus/areaJurisdiction/batchRemove',
    method: 'POST',
    data: ids
  })
}

// 切换管理区域管辖范围配置状态
export function toggleAreaJurisdictionStatus(id, data) {
  return request({
    url: `/api/campus/areaJurisdiction/${id}/toggleStatus`,
    method: 'POST',
    data
  })
}

// 检查重复配置
export function checkAreaJurisdictionDuplicate(data) {
  return request({
    url: '/api/campus/areaJurisdiction/checkDuplicate',
    method: 'POST',
    data
  })
}

// 根据省市查询管理区域
export function getAreaByLocation(provinceId, cityId) {
  return request({
    url: '/api/campus/areaJurisdiction/getAreaByLocation',
    method: 'GET',
    data: { provinceId, cityId }
  })
}

// 获取省份列表
export function getProvinceList() {
  return request({
    url: '/api/base/province',
    method: 'GET'
  })
}

// 获取城市列表
export function getCityList(provinceId) {
  return request({
    url: '/api/base/city',
    method: 'GET',
    data: { provinceId }
  })
}

// 导出管理区域管辖范围配置
export function exportAreaJurisdiction(data) {
  return request({
    url: '/api/campus/areaJurisdiction/Actions/Export',
    method: 'GET',
    data
  })
}

// 获取管理区域统计信息
export function getAreaJurisdictionStats() {
  return request({
    url: '/api/campus/areaJurisdiction/stats',
    method: 'GET'
  })
}